package com.yfh.sharding.datasource.controller;



import com.yfh.sharding.datasource.aop.annotation.ShardingCut;
import com.yfh.sharding.datasource.constants.DatasourceType;
import com.yfh.sharding.datasource.entity.SysUser;
import com.yfh.sharding.datasource.service.SysUserService;
import com.yfh.sharding.datasource.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhangqiang
 * @since 2021-03-03
 */
@RestController
@RequestMapping("/sysUser")
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;


    @GetMapping("userList")
    @ShardingCut(dataSource = DatasourceType.DATASOURCE_USER)
    public Result userList() {
        List<SysUser> list = sysUserService.list();
        return Result.success(list);
    }

}

